export const menuUpdateDataForm = {
  name: "",
  menuType: "",
  icon: "",
  query: "",
  component: "",
  perms: "",
  sort: "",
  isEnable:true,
  isShow:true,
  remark: "",
  parentId: "",
};

//校验图标是否必选
const checkIcon = (rule, value, callback) => {
  if (menuUpdateDataForm.menuType !== "F" && !value) {
    callback(new Error("请选择菜单图标!"));
  }
  callback();
};


//校验路由组件是否必传
const checkComponent = (rule, value, callback) => {
  if (menuUpdateDataForm.menuType === "C" && !value) {
    callback(new Error("请填写路由组件路径!"));
  }
  callback();
};

export const menuUpdateDataFormRles = {
  name: [
    {
      message: "菜单名称不允许为空",
      required: true,
      trigger: "blur",
    },
  ],
  menuType: [
    {
      message: "菜单类型不允许为空",
      required: true,
      trigger: "blur",
    },
  ],
  icon: [{ validator: checkIcon, trigger: "blur" }],
  component: [{ validator: checkComponent, trigger: "blur" }],
};
